import fetch from 'common/src/utils/fetch'
import UTILS from "common/src/utils/utils";


function getRounds(data) {
    return fetch({
        url: `/api/electionservice/agentElc/getRounds`,
        method: 'post',
        params: data
    });
}
function loading(data) {
    return fetch({
        url: `/api/electionservice/agentElc/loading`,
        method: 'post',
        data: data
    });
}
function getData(data) {
    return fetch({
        url: `/api/electionservice/agentElc/getData`,
        method: 'post',
        data: data
    });
}
function getDataBk(data) {
    return fetch({
        url: `/api/electionservice/agentElc/getDataBk`,
        method: 'post',
        data: data
    });
}

function elect(data) {
    return fetch({
        url: `/api/electionservice/agentElc/elect`,
        method: 'post',
        data: data
    });
}
function electRes(data) {
    return fetch({
        url: `/api/electionservice/agentElc/electRes`,
        method: 'post',
        data: data
    });
}

function findStuRound(data) {
    return fetch({
        url: `/api/electionservice/agentElc/findStuRound`,
        method: 'post',
        data: data
    });
}

/**
 * 研究生获取轮次
 */
function getRoundsYjs(data) {
    return fetch({
        url: `/api/electionservice/agentElc/getGraduateRounds`,
        method: 'post',
        params: data
    });
}

/**
 *研究生可选课程
 */
function findUnselectedCourseList(data) {
    return fetch({
        url: 'api/electionservice/student/getOptionalCourses?roundId=' + data.roundId,
        method: 'get',
        data: data
    });
}

/**
 * 本研互选
*/
function getRoundsMutual(data) {
     return fetch({
         url: `/api/electionservice/elecMutualAgent/getRounds`,
         method: 'post',
         params: data
     });
}

function findStuRoundMutual(data) {
    return fetch({
        url: `/api/electionservice/elecMutualAgent/findStuRound`,
        method: 'post',
        data: data
    });
}

function loadingMutual(data) {
    return fetch({
        url: '/api/electionservice/elecMutualAgent/'+ data.roundId+'/loading',
        method: 'post',
        data: data
    });
}

function getDataMutual(data) {
    return fetch({
        url: '/api/electionservice/elecMutualAgent/'+ data.roundId +'/getData'+ '?studentId=' + data.studentId,
        method: 'post',
        data: data
    });
}

function mutualElect(data) {
    return fetch({
        url: `/api/electionservice/elecMutualAgent/elect`,
        method: 'post',
        data: data
    });
}

function electMutualRes(data) {
    return fetch({
        url: '/api/electionservice/elecMutualAgent/'+ data.roundId +'/electRes',
        method: 'post',
        data: data
    });
}
function loginCheck(data) {//本研互选选课结果
    return fetch({
        url: `/api/electionservice/student/loginCheck`,
        method: 'post',
        data: data
    });
}
export default {
    "agentElcStudentListUrl": "/api/electionservice/agentElc/findAgentElcStudentList", //代理选课学生列表URL
    "getRounds": getRounds, //查询可用轮次
    "findStuRound": findStuRound, //查询可用轮次
    "loading": loading, // 初始化数据
    "getData": getData, // 初始化数据
    "getDataBk": getDataBk, // 初始化数据本科
    "getRoundsMutual": getRoundsMutual,  //本研互选--可用轮次
    "findStuRoundMutual": findStuRoundMutual, //本研互选--查询学生
    "loadingMutual": loadingMutual, //本研互选--loading
    "getDataMutual": getDataMutual, //本研互选--初始化数据
    "mutualElect": mutualElect, //本研互选--选课
    "electMutualRes": electMutualRes, //本研互选--选课结果
    "elect": elect, // 选课
    "electRes": electRes, // 选课结果
    "getRoundsYjs": getRoundsYjs, //研究生查询可用轮次
    "findUnselectedCourseList": findUnselectedCourseList, // 研究生可选课程
    loginCheck: loginCheck,
    "payUrl": "/api/electionservice/microCourseCharge/findStuMicroPayment",
}
